<template>
  <Tooltip content="水平翻转" placement="top">
    <flipX class="options-item" width="18" @click="flip('X')" height="18" />
  </Tooltip>
</template>

<script setup name="Flip">
import useSelect from '@/hooks/select';
import flipX from '@/assets/icon/flip/x.svg';

const { canvasEditor } = useSelect();

const flip = (type) => {
  const activeObject = canvasEditor.canvas.getActiveObject();
  activeObject.set(`flip${type}`, !activeObject[`flip${type}`]).setCoords();
  canvasEditor.canvas.requestRenderAll();
};
</script>

<style scoped lang="less"></style>
